//
//  ViewController.m
//  作业2
//
//  Created by dllo on 16/7/15.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor blueColor];
    // 背景imageView
    self.lagouImageView = [LagouImageView createImageView];
    [self.view addSubview:_lagouImageView];
    [_lagouImageView setTag:1001];
    // 两个textField
    self.inputView = [LagouView createViewWithImageName1:@"icon_person@3x.png" imageName2:@"icon_password@3x.png" string1:@"请输入已验证的手机号或邮箱" string2:@"请输入密码" identifyString:nil viewframe:CGRectMake(0, 0, WIDTH - 20, 100) center:CGPointMake(WIDTH / 2, HEIGHT / 2) leftViewColor:[UIColor darkGrayColor] textFieldBackgroundColor:[UIColor darkGrayColor] cursorMove:YES];
    // createViewWithImageName1:@"icon_person@3x.png" imageName2:@"icon_password@3x.png" string1:@"请输入已验证的手机号或邮箱" string2:@"请输入密码" identifyString:nil
    [_lagouImageView addSubview:_inputView];
    
    // 登录,注册button
    self.loginView = [LagouView createViewWithString1:@"忘记密码" string2:@"登录" string3:@"注册拉勾"];
    [_lagouImageView addSubview:_loginView];
    // 添加注册事件
    [_loginView.registerButton addTarget:self action:@selector(click2) forControlEvents:UIControlEventTouchUpInside];
   // 添加忘记密码事件
    [_loginView.infoHelpButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
   

}
- (void)click {
    VerifyViewController *verifyVC = [[VerifyViewController alloc] init];
    // 不用系统的动画,自定义
    // CATransition 的父类是CAAnimation->父类是NSObject
    // CATransition的遍历构造器初始化方法,它是父类CAAnimation的初始化方法
    CATransition *animation = [CATransition animation];
    animation.duration = 0.3;
    // 还是父类CAAnimation的属性
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    /**UIViewAnimationCurveEaseInOut,         // slow at beginning and end
     UIViewAnimationCurveEaseIn,            // slow at beginning
     UIViewAnimationCurveEaseOut,           // slow at end
     UIViewAnimationCurveLinear*/
    // 其他枚举值怎么不能用?

    // 自身属性,
    // type有两种表达方式,第一种是@"字符串",
    // @"pageCurl"(向上翻一页),@"pageUnCurl"(向下翻一页),@"rippleEffect"(滴水效果),@"suckEffect"(收缩效果,如一块布被抽走),@"cube"(立方体效果),@"oglflip"(上下翻转效果),
    //第二种是枚举值(kCATransitionFade,MoveIn,Push,Reveal
    // 分别对应 淡出,覆盖原图,推出,底部现出来
//    animation.type = @"pageCurl";
    animation.type = kCATransitionPush;
    // subtype 四种枚举值(从"上", "下", "左", "右"进入)
    animation.subtype = kCATransitionFromRight;
    // 在window 的layer层上添加动画
    [self.view.window.layer addAnimation:animation forKey:nil];
    // 自定义要关闭系统动画

    [self presentViewController:verifyVC animated:NO completion:^{
        
        
    }];
}
    
- (void)click2 {
    RegisterViewController *registerVC = [[RegisterViewController alloc] init];
    [self presentViewController:registerVC animated:NO completion:^{
 
    }];
    
}
/**- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    // 给键盘上移添加监听者,当键盘出现或消失发出消息
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}*/
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    
}
/**- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:YES];
    // 删除通知中心监听
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}*/
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/**#pragma mark - 键盘显示
- (void)keyboardWillShow:(NSNotification *)notification {
    CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGFloat height = keyboardFrame.origin.y;
//    CGFloat textField_maxY = (_cu)
}
#pragma mark - 键盘隐藏
- (void)keyboardWillHide:(NSNotification *)notification {
    
}*/
@end
